<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Reranker Framework (ReFr): model.H Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Reranker Framework (ReFr)
   
   </div>
   <div id="projectbrief">Reranking framework for structure prediction and discriminative language modeling</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">model.H</div>  </div>
</div><!--header-->
<div class="contents">
<a href="model_8_h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright 2012, Google Inc.</span>
<a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span>
<a name="l00003"></a>00003 <span class="comment">// </span>
<a name="l00004"></a>00004 <span class="comment">// Redistribution and use in source and binary forms, with or without</span>
<a name="l00005"></a>00005 <span class="comment">// modification, are permitted provided that the following conditions are</span>
<a name="l00006"></a>00006 <span class="comment">// met:</span>
<a name="l00007"></a>00007 <span class="comment">// </span>
<a name="l00008"></a>00008 <span class="comment">//   * Redistributions of source code must retain the above copyright</span>
<a name="l00009"></a>00009 <span class="comment">//     notice, this list of conditions and the following disclaimer.</span>
<a name="l00010"></a>00010 <span class="comment">//   * Redistributions in binary form must reproduce the above</span>
<a name="l00011"></a>00011 <span class="comment">//     copyright notice, this list of conditions and the following disclaimer</span>
<a name="l00012"></a>00012 <span class="comment">//     in the documentation and/or other materials provided with the</span>
<a name="l00013"></a>00013 <span class="comment">//     distribution.</span>
<a name="l00014"></a>00014 <span class="comment">//   * Neither the name of Google Inc. nor the names of its</span>
<a name="l00015"></a>00015 <span class="comment">//     contributors may be used to endorse or promote products derived from</span>
<a name="l00016"></a>00016 <span class="comment">//     this software without specific prior written permission.</span>
<a name="l00017"></a>00017 <span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment">// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span>
<a name="l00019"></a>00019 <span class="comment">// &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>
<a name="l00020"></a>00020 <span class="comment">// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span>
<a name="l00021"></a>00021 <span class="comment">// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span>
<a name="l00022"></a>00022 <span class="comment">// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00023"></a>00023 <span class="comment">// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span>
<a name="l00024"></a>00024 <span class="comment">// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,           </span>
<a name="l00025"></a>00025 <span class="comment">// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY           </span>
<a name="l00026"></a>00026 <span class="comment">// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
<a name="l00027"></a>00027 <span class="comment">// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span>
<a name="l00028"></a>00028 <span class="comment">// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00029"></a>00029 <span class="comment">// -----------------------------------------------------------------------------</span>
<a name="l00030"></a>00030 <span class="comment">//</span>
<a name="l00031"></a>00031 <span class="comment">//</span>
<a name="l00035"></a>00035 <span class="comment"></span>
<a name="l00036"></a>00036 <span class="preprocessor">#ifndef RERANKER_MODEL_H_</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define RERANKER_MODEL_H_</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;tr1/memory&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="candidate-set_8_h.html" title="Class to hold a single training instance for a reranker, which is a set of examples, typically the n-best output of some input process, posibly including a gold-standard feature vector.">candidate-set.H</a>&quot;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &quot;<a class="code" href="candidate-set-iterator_8_h.html" title="Provides an interface and some implementations for iterating over CandidateSet  instances.">candidate-set-iterator.H</a>&quot;</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include &quot;<a class="code" href="kernel-function_8_h.html" title="Provides the reranker::KernelFunction interface.">kernel-function.H</a>&quot;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &quot;<a class="code" href="symbol-table_8_h.html" title="Provides the reranker::Symbols interface as well as the reranker::StaticSymbolTable implementation...">symbol-table.H</a>&quot;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &quot;<a class="code" href="training-time_8_h.html" title="Provides the reranker::Time class, which holds the three notions of training time: current epoch...">training-time.H</a>&quot;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include &quot;<a class="code" href="factory_8_h.html" title="Provides a generic dynamic object factory.">factory.H</a>&quot;</span>
<a name="l00049"></a>00049 
<a name="l00052"></a>00052 <span class="keyword">namespace </span>reranker {
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="keyword">using</span> std::vector;
<a name="l00055"></a>00055 <span class="keyword">using</span> std::tr1::shared_ptr;
<a name="l00056"></a>00056 
<a name="l00060"></a><a class="code" href="classreranker_1_1_default_score_comparator.html">00060</a> <span class="keyword">class </span><a class="code" href="classreranker_1_1_default_score_comparator.html" title="The default comparator for comparing two Candidate instances based on their respective scores (i...">DefaultScoreComparator</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a>::Comparator {
<a name="l00061"></a>00061  <span class="keyword">public</span>:
<a name="l00066"></a><a class="code" href="classreranker_1_1_default_score_comparator.html#a30bceaf8aca6f6e05d29c8ae576262fd">00066</a>   <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_default_score_comparator.html#a30bceaf8aca6f6e05d29c8ae576262fd" title="Returns 0 if the two candidates&rsquo; scores are equal, less than zero if the score of c1 is less than tha...">Compare</a>(<span class="keyword">const</span> <a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> &amp;model,
<a name="l00067"></a>00067                       <span class="keyword">const</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a> &amp;c1, <span class="keyword">const</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a> &amp;c2) {
<a name="l00068"></a>00068     <span class="keywordtype">double</span> score_diff = c1.<a class="code" href="classreranker_1_1_candidate.html#a49d5bb385b20eaaef51a6987a7a230d1" title="Returns the reranker&rsquo;s score for this candidate.">score</a>() - c2.<a class="code" href="classreranker_1_1_candidate.html#a49d5bb385b20eaaef51a6987a7a230d1" title="Returns the reranker&rsquo;s score for this candidate.">score</a>();
<a name="l00069"></a>00069     <span class="keywordflow">return</span> score_diff == 0.0 ? 0 : (score_diff &lt; 0.0 ? -1 : 1);
<a name="l00070"></a>00070   }
<a name="l00071"></a>00071 };
<a name="l00072"></a>00072 
<a name="l00075"></a><a class="code" href="classreranker_1_1_default_gold_comparator.html">00075</a> <span class="keyword">class </span><a class="code" href="classreranker_1_1_default_gold_comparator.html" title="The default comparator for comparing two Candidate instances for being the &ldquo;gold&rdquo; candidate...">DefaultGoldComparator</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a>::Comparator {
<a name="l00076"></a>00076  <span class="keyword">public</span>:
<a name="l00085"></a><a class="code" href="classreranker_1_1_default_gold_comparator.html#a42ff50376d0ac06dc6d8fa41d395a82f">00085</a>   <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_default_gold_comparator.html#a42ff50376d0ac06dc6d8fa41d395a82f" title="This method first compares c1 to c2 based on their respective losses (i.e., the values returned by in...">Compare</a>(<span class="keyword">const</span> <a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> &amp;model,
<a name="l00086"></a>00086                       <span class="keyword">const</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a> &amp;c1, <span class="keyword">const</span> <a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a> &amp;c2) {
<a name="l00087"></a>00087     <span class="keywordtype">double</span> loss_diff = c1.<a class="code" href="classreranker_1_1_candidate.html#a024f88c11b795a31cb8f5d1b47150701" title="Returns the loss of this candidate.">loss</a>() - c2.<a class="code" href="classreranker_1_1_candidate.html#a024f88c11b795a31cb8f5d1b47150701" title="Returns the loss of this candidate.">loss</a>();
<a name="l00088"></a>00088     <span class="keywordtype">double</span> score_diff = c1.<a class="code" href="classreranker_1_1_candidate.html#a49d5bb385b20eaaef51a6987a7a230d1" title="Returns the reranker&rsquo;s score for this candidate.">score</a>() - c2.<a class="code" href="classreranker_1_1_candidate.html#a49d5bb385b20eaaef51a6987a7a230d1" title="Returns the reranker&rsquo;s score for this candidate.">score</a>();
<a name="l00089"></a>00089     <span class="comment">// If c1 has &quot;less loss&quot; it is &quot;better&quot;, so we return 1.</span>
<a name="l00090"></a>00090     <span class="keywordflow">if</span> (loss_diff &lt; 0.0) {
<a name="l00091"></a>00091       <span class="keywordflow">return</span> 1;
<a name="l00092"></a>00092     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (loss_diff &gt; 0.0) {
<a name="l00093"></a>00093       <span class="keywordflow">return</span> -1;
<a name="l00094"></a>00094     } <span class="keywordflow">else</span> {
<a name="l00095"></a>00095       <span class="comment">// If c1&amp;rsquo;s and c2&amp;rsquo;s losses are equal, we compare</span>
<a name="l00096"></a>00096       <span class="comment">// them based on score, where a higher score is &amp;ldquo;better&amp;rdquo;</span>
<a name="l00097"></a>00097       <span class="comment">// (meaning a positive return value).</span>
<a name="l00098"></a>00098       <span class="keywordflow">return</span> score_diff == 0.0 ? 0 : (score_diff &lt; 0.0 ? -1 : 1);
<a name="l00099"></a>00099     }
<a name="l00100"></a>00100   }
<a name="l00101"></a>00101 };
<a name="l00102"></a>00102 
<a name="l00109"></a><a class="code" href="classreranker_1_1_default_candidate_set_scorer.html">00109</a> <span class="keyword">class </span><a class="code" href="classreranker_1_1_default_candidate_set_scorer.html" title="The default candidate set scorer scores each candidate using the Model::ScoreCandidate method and the...">DefaultCandidateSetScorer</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a>::Scorer {
<a name="l00110"></a>00110  <span class="keyword">public</span>:
<a name="l00111"></a>00111   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_default_candidate_set_scorer.html#a1d6db4a2392e098c8afbef0e55b23fe1">Score</a>(<a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> *model,
<a name="l00112"></a>00112                      <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;candidates, <span class="keywordtype">bool</span> training);
<a name="l00113"></a>00113 };
<a name="l00114"></a>00114 
<a name="l00119"></a><a class="code" href="classreranker_1_1_random_pair_candidate_set_scorer.html">00119</a> <span class="keyword">class </span><a class="code" href="classreranker_1_1_random_pair_candidate_set_scorer.html" title="This candidate set scorer picks two candidates at random from the set, scores them and then identifie...">RandomPairCandidateSetScorer</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a>::Scorer {
<a name="l00120"></a>00120  <span class="keyword">public</span>:
<a name="l00123"></a>00123   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_random_pair_candidate_set_scorer.html#a7abfd508156ab23d326794cab17bd530" title="Initializes the random seed using srand and the current time available by calling time(NULL)...">Init</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;arg);
<a name="l00128"></a>00128   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_random_pair_candidate_set_scorer.html#a9e1eba023ff20c3b354cc009bc885db1" title="Picks two candidates at random from the set, scores them and then identifies which has the higher sco...">Score</a>(<a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> *model,
<a name="l00129"></a>00129                      <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;candidates, <span class="keywordtype">bool</span> training);
<a name="l00130"></a>00130  <span class="keyword">private</span>:
<a name="l00133"></a>00133   <span class="keywordtype">size_t</span> GetRandomIndex(<span class="keywordtype">size_t</span> max);
<a name="l00134"></a>00134 };
<a name="l00135"></a>00135 
<a name="l00141"></a><a class="code" href="classreranker_1_1_model.html">00141</a> <span class="keyword">class </span><a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_factory_constructible.html" title="An interface to make it easier to implement Factory-constructible types by implementing both required...">FactoryConstructible</a> {
<a name="l00142"></a>00142  <span class="keyword">public</span>:
<a name="l00145"></a><a class="code" href="classreranker_1_1_model.html#ad2e716fbaa2f40daecbfb474d8a1a3bb">00145</a>   <a class="code" href="classreranker_1_1_model.html#ad2e716fbaa2f40daecbfb474d8a1a3bb" title="Constructs a new instance with the empty string for its name and a NULL kernel function.">Model</a>() : <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>(<span class="stringliteral">&quot;&quot;</span>), <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>(), <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>(NULL),
<a name="l00146"></a>00146             <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>(new <a class="code" href="classreranker_1_1_local_symbol_table.html" title="A symbol table that stores the mapping from symbols to int&rsquo;s and vice versa in local (non-static) dat...">LocalSymbolTable</a>()),
<a name="l00147"></a>00147             <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>(),
<a name="l00148"></a>00148             <a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b" title="The number of testing errors made on held-out development test data for each epoch.">num_testing_errors_per_epoch_</a>(),
<a name="l00149"></a>00149             <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>(),
<a name="l00150"></a>00150             <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>(0), <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>(0),
<a name="l00151"></a>00151             <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>(-1), <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>(-1),
<a name="l00152"></a>00152             <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>(NULL) {  
<a name="l00153"></a>00153     <a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">SetDefaultObjects</a>();
<a name="l00154"></a>00154   }
<a name="l00155"></a>00155 
<a name="l00156"></a>00156 
<a name="l00160"></a><a class="code" href="classreranker_1_1_model.html#ac3f1e74c09f7d84a2d251d4cae7cbfb9">00160</a>   <a class="code" href="classreranker_1_1_model.html#ad2e716fbaa2f40daecbfb474d8a1a3bb" title="Constructs a new instance with the empty string for its name and a NULL kernel function.">Model</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>) :
<a name="l00161"></a>00161       <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>(name), <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>(), <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>(NULL),
<a name="l00162"></a>00162       <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>(new <a class="code" href="classreranker_1_1_local_symbol_table.html" title="A symbol table that stores the mapping from symbols to int&rsquo;s and vice versa in local (non-static) dat...">LocalSymbolTable</a>()),
<a name="l00163"></a>00163       <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>(),
<a name="l00164"></a>00164       <a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b" title="The number of testing errors made on held-out development test data for each epoch.">num_testing_errors_per_epoch_</a>(),
<a name="l00165"></a>00165       <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>(),
<a name="l00166"></a>00166       <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>(0), <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>(0),
<a name="l00167"></a>00167       <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>(-1), <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>(-1),
<a name="l00168"></a>00168       <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>(NULL) {
<a name="l00169"></a>00169     <a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">SetDefaultObjects</a>();
<a name="l00170"></a>00170   }
<a name="l00171"></a>00171 
<a name="l00177"></a><a class="code" href="classreranker_1_1_model.html#a5f725de423051610d138c69dfa740be4">00177</a>   <a class="code" href="classreranker_1_1_model.html#ad2e716fbaa2f40daecbfb474d8a1a3bb" title="Constructs a new instance with the empty string for its name and a NULL kernel function.">Model</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>, <a class="code" href="classreranker_1_1_kernel_function.html" title="An interface specifying a kernel function for two FeatureVector instances.">KernelFunction</a> *kernel_fn) :
<a name="l00178"></a>00178       <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>(name), <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>(), <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>(kernel_fn),
<a name="l00179"></a>00179       <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>(new <a class="code" href="classreranker_1_1_local_symbol_table.html" title="A symbol table that stores the mapping from symbols to int&rsquo;s and vice versa in local (non-static) dat...">LocalSymbolTable</a>()),
<a name="l00180"></a>00180       <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>(),
<a name="l00181"></a>00181       <a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b" title="The number of testing errors made on held-out development test data for each epoch.">num_testing_errors_per_epoch_</a>(),
<a name="l00182"></a>00182       <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>(),
<a name="l00183"></a>00183       <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>(0),
<a name="l00184"></a>00184       <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>(0),
<a name="l00185"></a>00185       <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>(-1), <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>(-1),
<a name="l00186"></a>00186       <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>(NULL) {
<a name="l00187"></a>00187     <a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">SetDefaultObjects</a>();
<a name="l00188"></a>00188   }
<a name="l00189"></a>00189 
<a name="l00198"></a><a class="code" href="classreranker_1_1_model.html#a6890296beda9419113615eab5f490d47">00198</a>   <a class="code" href="classreranker_1_1_model.html#ad2e716fbaa2f40daecbfb474d8a1a3bb" title="Constructs a new instance with the empty string for its name and a NULL kernel function.">Model</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>, <a class="code" href="classreranker_1_1_kernel_function.html" title="An interface specifying a kernel function for two FeatureVector instances.">KernelFunction</a> *kernel_fn,
<a name="l00199"></a>00199         <a class="code" href="classreranker_1_1_symbols.html" title="An interface specifying a converter from symbols (strings) to int indices.">Symbols</a> *<a class="code" href="classreranker_1_1_model.html#a736bec0b8f468285580982df181a7cd0" title="Returns the symbol table for this model.">symbols</a>) :
<a name="l00200"></a>00200       <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>(name), <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>(), <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>(kernel_fn),
<a name="l00201"></a>00201       <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>(symbols),
<a name="l00202"></a>00202       <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>(),
<a name="l00203"></a>00203       <a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b" title="The number of testing errors made on held-out development test data for each epoch.">num_testing_errors_per_epoch_</a>(),
<a name="l00204"></a>00204       <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>(),
<a name="l00205"></a>00205       <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>(0),
<a name="l00206"></a>00206       <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>(0),
<a name="l00207"></a>00207       <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>(-1), <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>(-1),
<a name="l00208"></a>00208       <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>(NULL) {
<a name="l00209"></a>00209     <a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">SetDefaultObjects</a>();
<a name="l00210"></a>00210   }
<a name="l00211"></a>00211 
<a name="l00213"></a><a class="code" href="classreranker_1_1_model.html#ab9db93974f414dab2de059b4d5f76758">00213</a>   <span class="keyword">virtual</span> <a class="code" href="classreranker_1_1_model.html#ab9db93974f414dab2de059b4d5f76758" title="Destroys this model and its associated kernel function.">~Model</a>() {
<a name="l00214"></a>00214     <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>;
<a name="l00215"></a>00215     <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>;
<a name="l00216"></a>00216     <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>;
<a name="l00217"></a>00217   }
<a name="l00218"></a>00218 
<a name="l00219"></a>00219   <span class="comment">// inner interfaces</span>
<a name="l00220"></a>00220 
<a name="l00223"></a><a class="code" href="classreranker_1_1_model_1_1_hook.html">00223</a>   <span class="keyword">class </span><a class="code" href="classreranker_1_1_model_1_1_hook.html" title="An interface for specifying a hook to be run by a Model instance.">Hook</a> {
<a name="l00224"></a>00224    <span class="keyword">public</span>:
<a name="l00230"></a>00230     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model_1_1_hook.html#a676b9a02709b0a61856a8ff246f182d6" title="The function to be executed by the Model that wraps this hook.">Do</a>(<a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> *model) = 0;
<a name="l00231"></a>00231   };
<a name="l00232"></a>00232 
<a name="l00242"></a><a class="code" href="classreranker_1_1_model_1_1_update_predicate.html">00242</a>   <span class="keyword">class </span><a class="code" href="classreranker_1_1_model_1_1_update_predicate.html" title="An inner interface for a predicate that tests whether a Model needs to be updated based on the curren...">UpdatePredicate</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_factory_constructible.html" title="An interface to make it easier to implement Factory-constructible types by implementing both required...">FactoryConstructible</a> {
<a name="l00243"></a>00243    <span class="keyword">public</span>:
<a name="l00249"></a><a class="code" href="classreranker_1_1_model_1_1_update_predicate.html#a47a46797969316fb3ee558e5d34d27e7">00249</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model_1_1_update_predicate.html#a47a46797969316fb3ee558e5d34d27e7" title="An initialization method, guaranteed to be invoked by Factory after initial construction.">Init</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;arg) { }
<a name="l00257"></a>00257     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model_1_1_update_predicate.html#a5a62afd01a1873c97843a21954703ec9" title="Returns whether the specified needs to be updated based on the specified training example...">NeedToUpdate</a>(<a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> *model, <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;example) = 0;
<a name="l00258"></a>00258   };
<a name="l00259"></a>00259 
<a name="l00273"></a><a class="code" href="classreranker_1_1_model_1_1_updater.html">00273</a>   <span class="keyword">class </span><a class="code" href="classreranker_1_1_model_1_1_updater.html" title="An inner interface specifying an update function for a model.">Updater</a> : <span class="keyword">public</span> <a class="code" href="classreranker_1_1_factory_constructible.html" title="An interface to make it easier to implement Factory-constructible types by implementing both required...">FactoryConstructible</a> {
<a name="l00274"></a>00274    <span class="keyword">public</span>:
<a name="l00280"></a><a class="code" href="classreranker_1_1_model_1_1_updater.html#af60b901342616c37d7ceb6efb4b3f78c">00280</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model_1_1_updater.html#af60b901342616c37d7ceb6efb4b3f78c" title="An initialization method, guaranteed to be invoked by Factory after initial construction.">Init</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;arg) { }
<a name="l00286"></a>00286     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model_1_1_updater.html#acf83dba3346238f42f4e903d00ad56b3" title="Updates this model based on the specified training example.">Update</a>(<a class="code" href="classreranker_1_1_model.html" title="Model is an interface for reranking models.">Model</a> *model, <a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;example) = 0;
<a name="l00287"></a>00287   };
<a name="l00288"></a>00288 
<a name="l00289"></a>00289   <span class="comment">// accessors</span>
<a name="l00290"></a>00290 
<a name="l00292"></a><a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c">00292</a>   <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>; }
<a name="l00293"></a>00293 
<a name="l00295"></a><a class="code" href="classreranker_1_1_model.html#a736bec0b8f468285580982df181a7cd0">00295</a>   <a class="code" href="classreranker_1_1_symbols.html" title="An interface specifying a converter from symbols (strings) to int indices.">Symbols</a> *<a class="code" href="classreranker_1_1_model.html#a736bec0b8f468285580982df181a7cd0" title="Returns the symbol table for this model.">symbols</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>; }
<a name="l00296"></a>00296 
<a name="l00301"></a><a class="code" href="classreranker_1_1_model.html#a6385b58c2b89e43f00033bbed7ead046">00301</a>   <span class="keyword">const</span> <a class="code" href="classreranker_1_1_time.html" title="A simple class to hold the three notions of time during training: the current epoch, the current time index within the current epoch, and the absolute time index.">Time</a> &amp;<a class="code" href="classreranker_1_1_model.html#a6385b58c2b89e43f00033bbed7ead046" title="Returns the current training time of this model: number of epochs, number of time steps in the curren...">time</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>; }
<a name="l00302"></a>00302 
<a name="l00303"></a>00303   <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#a02b18d754bc85251690f9ffe09c0a86e">best_model_epoch</a>() <span class="keyword">const</span> = 0;
<a name="l00304"></a>00304 
<a name="l00308"></a><a class="code" href="classreranker_1_1_model.html#ad913f9f96a40e22443cd95b04d693887">00308</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#ad913f9f96a40e22443cd95b04d693887" title="Returns the number of updates made by this model.">num_updates</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>; }
<a name="l00312"></a><a class="code" href="classreranker_1_1_model.html#ada68b9f869ede8de97d35c50cd7e5e5c">00312</a>   <span class="keyword">const</span> vector&lt;int&gt; &amp;<a class="code" href="classreranker_1_1_model.html#ada68b9f869ede8de97d35c50cd7e5e5c" title="Returns the number of training errors made for each epoch.">num_training_errors_per_epoch</a>() {
<a name="l00313"></a>00313     <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>;
<a name="l00314"></a>00314   }
<a name="l00318"></a><a class="code" href="classreranker_1_1_model.html#a46c143623d0f7b51040927aa0fd9197b">00318</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#a46c143623d0f7b51040927aa0fd9197b" title="Returns the number of training errors made by this model.">num_training_errors</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>; }
<a name="l00319"></a>00319 
<a name="l00321"></a><a class="code" href="classreranker_1_1_model.html#ae376fddf5518ab1e7a9f5b5d114afe7b">00321</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#ae376fddf5518ab1e7a9f5b5d114afe7b" title="Returns the minimum number of epochs to train.">min_epochs</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>; }
<a name="l00322"></a>00322 
<a name="l00324"></a><a class="code" href="classreranker_1_1_model.html#a02cba71a3c90cec312f0244c39ed30a5">00324</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#a02cba71a3c90cec312f0244c39ed30a5" title="Returns the maximum number of epochs to train.">max_epochs</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>; }
<a name="l00325"></a>00325 
<a name="l00327"></a><a class="code" href="classreranker_1_1_model.html#aeb377b3c084ca4b7a5d6afe3ba4e4a13">00327</a>   <span class="keyword">const</span> vector&lt;double&gt; &amp;<a class="code" href="classreranker_1_1_model.html#aeb377b3c084ca4b7a5d6afe3ba4e4a13" title="Returns the loss per epoch for epoch of training that was evaluated.">loss_per_epoch</a>() { <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>; }
<a name="l00328"></a>00328 
<a name="l00332"></a>00332   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a0e4935d14bb956cd7ab722e39790c9b7" title="Returns the spec string for constructing a default instance of this model so it may be properly de-se...">model_spec</a>() <span class="keyword">const</span> = 0;
<a name="l00333"></a>00333 
<a name="l00337"></a>00337   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a0fc70a87fe28a300cac5fd1af552e27f" title="Returns the spec string for contructing an instance of a ModelProtoReader capable of de-serializing t...">proto_reader_spec</a>() <span class="keyword">const</span> = 0;
<a name="l00338"></a>00338 
<a name="l00342"></a>00342   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#ac94d349353f82e74567ec9b56dbbdcdd" title="Returns the spec string for contructing an instance of a ModelProtoWriter capable of serializing this...">proto_writer_spec</a>() <span class="keyword">const</span> = 0;
<a name="l00343"></a>00343 
<a name="l00345"></a><a class="code" href="classreranker_1_1_model.html#aa58b2fee786c6402ea7429f7c2d27431">00345</a>   <span class="keyword">virtual</span> shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#aa58b2fee786c6402ea7429f7c2d27431" title="Returns a pointer to the score comparator used by this model.">score_comparator</a>() {
<a name="l00346"></a>00346     <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a9e7183bee1f50b058b17ab8e43cdbeef" title="A comparator to provide an ordering for candidates based on score when scoring all candidates in a se...">score_comparator_</a>;
<a name="l00347"></a>00347   }
<a name="l00348"></a>00348 
<a name="l00350"></a><a class="code" href="classreranker_1_1_model.html#ae13ea77e614feaf88faebfe37cd45224">00350</a>   <span class="keyword">virtual</span> shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#ae13ea77e614feaf88faebfe37cd45224" title="Returns a pointer to the gold comparator used by this model.">gold_comparator</a>() {
<a name="l00351"></a>00351     <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a8107be43f3916858a204c2d7c2f2d32e" title="A comparator to provide an ordering for candidates to find the gold candidate in a set...">gold_comparator_</a>;
<a name="l00352"></a>00352   }
<a name="l00353"></a>00353 
<a name="l00354"></a>00354   <span class="comment">// training methods</span>
<a name="l00355"></a>00355 
<a name="l00363"></a>00363   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model.html#a878991ef6241e976d565ac167dd3a157" title="Returns whether more training epochs are required for this model.">NeedToKeepTraining</a>()  = 0;
<a name="l00364"></a>00364 
<a name="l00365"></a>00365   <span class="comment">// TODO(dbikel,kbhall): Add Train method that takes MapInput (or</span>
<a name="l00366"></a>00366   <span class="comment">//                      Hadoop equivalent) for streaming input of</span>
<a name="l00367"></a>00367   <span class="comment">//                      CandidateSet instances.</span>
<a name="l00368"></a>00368 
<a name="l00379"></a>00379   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a0468287cffc492868548bc5627942734" title="Trains this model on a collection of training examples, where each training example is a set of candi...">Train</a>(<a class="code" href="classreranker_1_1_candidate_set_iterator.html" title="An interface specifying iteration over CandidateSet instances, using Java-style semantics (sorry...">CandidateSetIterator</a> &amp;examples,
<a name="l00380"></a>00380                      <a class="code" href="classreranker_1_1_candidate_set_iterator.html" title="An interface specifying iteration over CandidateSet instances, using Java-style semantics (sorry...">CandidateSetIterator</a> &amp;development_test) = 0;
<a name="l00381"></a>00381 
<a name="l00382"></a>00382   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a4c962a69b553f71c58a60aa6d86e7577">NewEpoch</a>() = 0;
<a name="l00383"></a>00383 
<a name="l00384"></a>00384   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a0392df23892406abcbf21bbe1bf5392a">EndOfEpoch</a>() = 0;
<a name="l00385"></a>00385 
<a name="l00391"></a>00391   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a6aeac4515eae1f8b6d7adf665f05060f" title="Trains this model for one epoch, i.e., a single pass through the specified set of training examples...">TrainOneEpoch</a>(<a class="code" href="classreranker_1_1_candidate_set_iterator.html" title="An interface specifying iteration over CandidateSet instances, using Java-style semantics (sorry...">CandidateSetIterator</a> &amp;examples) = 0;
<a name="l00392"></a>00392 
<a name="l00397"></a>00397   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#ad6a7660247d0c0477d5c4f01591a942b" title="Trains this model on the specified training example.">TrainOnExample</a>(<a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;example) = 0;
<a name="l00398"></a>00398 
<a name="l00409"></a>00409   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model.html#a2fff2752a2ec18289f26954daf526cb3" title="Indicates whether the current model needs to be updated.">NeedToUpdate</a>(<a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;example) = 0;
<a name="l00410"></a>00410 
<a name="l00419"></a>00419   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#aef926c377e32ce215bbc69847853e16e" title="Updates the current model based on the specified set of candidates.">Update</a>(<a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;example) = 0;
<a name="l00420"></a>00420 
<a name="l00433"></a>00433   <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classreranker_1_1_model.html#aaa962ac773eb3b4483452c846eda0f44" title="Evaluates this model on the specified set of held-out development test data.">Evaluate</a>(<a class="code" href="classreranker_1_1_candidate_set_iterator.html" title="An interface specifying iteration over CandidateSet instances, using Java-style semantics (sorry...">CandidateSetIterator</a> &amp;development_test)
<a name="l00434"></a>00434   = 0;
<a name="l00435"></a>00435 
<a name="l00443"></a>00443   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#ad8510757242f405b549473b5ce6f8911" title="Scores the specified set of candidates according to either the raw or averaged version of this percep...">ScoreCandidates</a>(<a class="code" href="classreranker_1_1_candidate_set.html" title="A class to hold a set of candidates, either for training or test.">CandidateSet</a> &amp;candidates, <span class="keywordtype">bool</span> training) = 0;
<a name="l00444"></a>00444 
<a name="l00454"></a>00454   <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classreranker_1_1_model.html#a5c8423bb022156759515b808f93751a9" title="Scores a candidate according to either the raw or averaged version of this perceptron model...">ScoreCandidate</a>(<a class="code" href="classreranker_1_1_candidate.html" title="A class to represent a candidate in a set of candidates that constitutes a training instance for a re...">Candidate</a> &amp;candidate, <span class="keywordtype">bool</span> training) = 0;
<a name="l00455"></a>00455 
<a name="l00456"></a>00456   <span class="comment">// mutators</span>
<a name="l00457"></a>00457 
<a name="l00460"></a><a class="code" href="classreranker_1_1_model.html#a9ceb029bcfd1f94e140c8ffb445ae480">00460</a>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a9ceb029bcfd1f94e140c8ffb445ae480" title="Sets the minimum number of epochs to train.">set_min_epochs</a>(<span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#ae376fddf5518ab1e7a9f5b5d114afe7b" title="Returns the minimum number of epochs to train.">min_epochs</a>) { <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a> = <a class="code" href="classreranker_1_1_model.html#ae376fddf5518ab1e7a9f5b5d114afe7b" title="Returns the minimum number of epochs to train.">min_epochs</a>; }
<a name="l00461"></a>00461 
<a name="l00464"></a><a class="code" href="classreranker_1_1_model.html#a0ab309493d66bb5231a7d19b81d0b997">00464</a>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a0ab309493d66bb5231a7d19b81d0b997" title="Sets the maximum number of epochs to train.">set_max_epochs</a>(<span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#a02cba71a3c90cec312f0244c39ed30a5" title="Returns the maximum number of epochs to train.">max_epochs</a>) { <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a> = <a class="code" href="classreranker_1_1_model.html#a02cba71a3c90cec312f0244c39ed30a5" title="Returns the maximum number of epochs to train.">max_epochs</a>; }
<a name="l00465"></a>00465 
<a name="l00471"></a>00471   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#aabd4a60963fac4b9b06f510a55b1dfd7" title="Renumbers the potentially sparse feature uid&rsquo;s so that they occupy the interval [0,n-1] densely, for n non-zero features in use by this model.">CompactifyFeatureUids</a>() = 0;
<a name="l00472"></a>00472 
<a name="l00473"></a><a class="code" href="classreranker_1_1_model.html#a82524ee041462b4f7be0b35bed8e27c1">00473</a>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a82524ee041462b4f7be0b35bed8e27c1">set_end_of_epoch_hook</a>(<a class="code" href="classreranker_1_1_model_1_1_hook.html" title="An interface for specifying a hook to be run by a Model instance.">Hook</a> *end_of_epoch_hook) {
<a name="l00474"></a>00474     <span class="keywordflow">if</span> (<a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a> != NULL) {
<a name="l00475"></a>00475       <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>;
<a name="l00476"></a>00476     }
<a name="l00477"></a>00477     <a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a> = end_of_epoch_hook;
<a name="l00478"></a>00478   }
<a name="l00479"></a>00479 
<a name="l00480"></a><a class="code" href="classreranker_1_1_model.html#a013aa52eb8693d1133a0d32740dffa5a">00480</a>   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model.html#a013aa52eb8693d1133a0d32740dffa5a">use_weighted_loss</a>() { <span class="keywordflow">return</span> <a class="code" href="classreranker_1_1_model.html#a0601602d295f4b069e11ddebf941c2a5" title="Indicates whether this model should weight each candidate&rsquo;s loss by the value returned by CandidateSe...">use_weighted_loss_</a>; }
<a name="l00481"></a>00481 
<a name="l00482"></a><a class="code" href="classreranker_1_1_model.html#abbcabce58d51fea59d81a6e71020e7cb">00482</a>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#abbcabce58d51fea59d81a6e71020e7cb">set_use_weighted_loss</a>(<span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model.html#a013aa52eb8693d1133a0d32740dffa5a">use_weighted_loss</a>) {
<a name="l00483"></a>00483     <a class="code" href="classreranker_1_1_model.html#a0601602d295f4b069e11ddebf941c2a5" title="Indicates whether this model should weight each candidate&rsquo;s loss by the value returned by CandidateSe...">use_weighted_loss_</a> = <a class="code" href="classreranker_1_1_model.html#a013aa52eb8693d1133a0d32740dffa5a">use_weighted_loss</a>;
<a name="l00484"></a>00484   }
<a name="l00485"></a>00485 
<a name="l00489"></a><a class="code" href="classreranker_1_1_model.html#ac8b9c5c951206127f87be6b2b76f9d8d">00489</a>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#ac8b9c5c951206127f87be6b2b76f9d8d" title="Sets the Symbols instance for this Model to be the specified instance.">set_symbols</a>(<a class="code" href="classreranker_1_1_symbols.html" title="An interface specifying a converter from symbols (strings) to int indices.">Symbols</a> *<a class="code" href="classreranker_1_1_model.html#a736bec0b8f468285580982df181a7cd0" title="Returns the symbol table for this model.">symbols</a>) {
<a name="l00490"></a>00490     <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>;
<a name="l00491"></a>00491     <a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a> = <a class="code" href="classreranker_1_1_model.html#a736bec0b8f468285580982df181a7cd0" title="Returns the symbol table for this model.">symbols</a>;
<a name="l00492"></a>00492   }
<a name="l00493"></a>00493 
<a name="l00494"></a>00494  <span class="keyword">protected</span>:
<a name="l00495"></a>00495   <span class="comment">// more mutators (protected, because they should only be used by subclasses)</span>
<a name="l00496"></a>00496 
<a name="l00498"></a><a class="code" href="classreranker_1_1_model.html#ae5c922a33c8643373424f860e880cf72">00498</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#ae5c922a33c8643373424f860e880cf72" title="Sets the name of this Model instance.">set_name</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>) { <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a> = <a class="code" href="classreranker_1_1_model.html#a7360b45e4a024759cd393b376209cf3c" title="Returns the unique name for this model instance.">name</a>; }
<a name="l00499"></a>00499 
<a name="l00502"></a><a class="code" href="classreranker_1_1_model.html#aaefb076ddcffefa2da7881579db7a7a9">00502</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#aaefb076ddcffefa2da7881579db7a7a9" title="Sets the kernel function for this model.">set_kernel_fn</a>(<a class="code" href="classreranker_1_1_kernel_function.html" title="An interface specifying a kernel function for two FeatureVector instances.">KernelFunction</a> *kernel_fn) {
<a name="l00503"></a>00503     <span class="keyword">delete</span> <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>;
<a name="l00504"></a>00504     <a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a> = kernel_fn;
<a name="l00505"></a>00505   }
<a name="l00506"></a>00506 
<a name="l00507"></a><a class="code" href="classreranker_1_1_model.html#a5345ab1669dc9300abed225ddc5c9a9e">00507</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a5345ab1669dc9300abed225ddc5c9a9e">set_score_comparator</a>(shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#aa58b2fee786c6402ea7429f7c2d27431" title="Returns a pointer to the score comparator used by this model.">score_comparator</a>)
<a name="l00508"></a>00508   {
<a name="l00509"></a>00509     <a class="code" href="classreranker_1_1_model.html#a9e7183bee1f50b058b17ab8e43cdbeef" title="A comparator to provide an ordering for candidates based on score when scoring all candidates in a se...">score_comparator_</a> = <a class="code" href="classreranker_1_1_model.html#aa58b2fee786c6402ea7429f7c2d27431" title="Returns a pointer to the score comparator used by this model.">score_comparator</a>;
<a name="l00510"></a>00510   }
<a name="l00511"></a>00511 
<a name="l00512"></a><a class="code" href="classreranker_1_1_model.html#a9c3b21c730eddb930756387bbac173fa">00512</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a9c3b21c730eddb930756387bbac173fa">set_gold_comparator</a>(shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#ae13ea77e614feaf88faebfe37cd45224" title="Returns a pointer to the gold comparator used by this model.">gold_comparator</a>) {
<a name="l00513"></a>00513     <a class="code" href="classreranker_1_1_model.html#a8107be43f3916858a204c2d7c2f2d32e" title="A comparator to provide an ordering for candidates to find the gold candidate in a set...">gold_comparator_</a> =  <a class="code" href="classreranker_1_1_model.html#ae13ea77e614feaf88faebfe37cd45224" title="Returns a pointer to the gold comparator used by this model.">gold_comparator</a>;
<a name="l00514"></a>00514   }
<a name="l00515"></a>00515 
<a name="l00516"></a><a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">00516</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a5ae78a37db26302ce041552de0032b6e">SetDefaultObjects</a>() {
<a name="l00517"></a>00517     <a class="code" href="classreranker_1_1_model.html#af5ad4399e59ddf4a82b37d8ee348a370">SetDefaultComparators</a>();
<a name="l00518"></a>00518     <a class="code" href="classreranker_1_1_model.html#af13a628eba8c6d9a14652dfe36d5da57">SetDefaultCandidateSetScorer</a>();
<a name="l00519"></a>00519   }
<a name="l00520"></a>00520 
<a name="l00521"></a><a class="code" href="classreranker_1_1_model.html#af5ad4399e59ddf4a82b37d8ee348a370">00521</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#af5ad4399e59ddf4a82b37d8ee348a370">SetDefaultComparators</a>() {
<a name="l00522"></a>00522     <a class="code" href="classreranker_1_1_model.html#a9e7183bee1f50b058b17ab8e43cdbeef" title="A comparator to provide an ordering for candidates based on score when scoring all candidates in a se...">score_comparator_</a> = <a class="code" href="classreranker_1_1_model.html#ab33dc7e4ee114be828db6eebf15bc47c">GetComparator</a>(<span class="stringliteral">&quot;DefaultScoreComparator()&quot;</span>);
<a name="l00523"></a>00523     <a class="code" href="classreranker_1_1_model.html#a8107be43f3916858a204c2d7c2f2d32e" title="A comparator to provide an ordering for candidates to find the gold candidate in a set...">gold_comparator_</a> = <a class="code" href="classreranker_1_1_model.html#ab33dc7e4ee114be828db6eebf15bc47c">GetComparator</a>(<span class="stringliteral">&quot;DefaultGoldComparator()&quot;</span>);
<a name="l00524"></a>00524   }
<a name="l00525"></a>00525 
<a name="l00526"></a><a class="code" href="classreranker_1_1_model.html#af13a628eba8c6d9a14652dfe36d5da57">00526</a>   <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#af13a628eba8c6d9a14652dfe36d5da57">SetDefaultCandidateSetScorer</a>() {
<a name="l00527"></a>00527     <a class="code" href="classreranker_1_1_model.html#abf7147622fb3c5801016fb7c479f3158" title="A scorer for CandidateSet instances.">candidate_set_scorer_</a> =
<a name="l00528"></a>00528         <a class="code" href="classreranker_1_1_model.html#a570719cf2126c0bb7d120a3dcd19f0f4">GetCandidateSetScorer</a>(<span class="stringliteral">&quot;DefaultCandidateSetScorer()&quot;</span>);
<a name="l00529"></a>00529   }
<a name="l00530"></a>00530 
<a name="l00531"></a>00531   shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#ab33dc7e4ee114be828db6eebf15bc47c">GetComparator</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spec) <span class="keyword">const</span>;
<a name="l00532"></a>00532 
<a name="l00533"></a>00533   shared_ptr&lt;CandidateSet::Scorer&gt; <a class="code" href="classreranker_1_1_model.html#a570719cf2126c0bb7d120a3dcd19f0f4">GetCandidateSetScorer</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spec)
<a name="l00534"></a>00534       <span class="keyword">const</span>;
<a name="l00535"></a>00535 
<a name="l00536"></a>00536   shared_ptr&lt;UpdatePredicate&gt; <a class="code" href="classreranker_1_1_model.html#a1f79bda31ef5b3ed236d77a79403d789">GetUpdatePredicate</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spec) <span class="keyword">const</span>;
<a name="l00537"></a>00537 
<a name="l00538"></a>00538   shared_ptr&lt;Updater&gt; <a class="code" href="classreranker_1_1_model.html#a66309617d0bdc5a615d843b2ae88e9d8">GetUpdater</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;spec) <span class="keyword">const</span>;
<a name="l00539"></a>00539 
<a name="l00551"></a>00551   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classreranker_1_1_model.html#a85e014c8643c0a12db3a891e4eb5dc5c" title="A helper method for implementing the Init method: throws a std::runtime_error if the number of tokens...">CheckNumberOfTokens</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;arg,
<a name="l00552"></a>00552                                    <span class="keyword">const</span> vector&lt;string&gt; &amp;tokens,
<a name="l00553"></a>00553                                    <span class="keywordtype">size_t</span> min_expected_number,
<a name="l00554"></a>00554                                    <span class="keywordtype">size_t</span> max_expected_number,
<a name="l00555"></a>00555                                    <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;class_name) <span class="keyword">const</span>;
<a name="l00556"></a>00556 
<a name="l00558"></a><a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6">00558</a>   <span class="keywordtype">string</span> <a class="code" href="classreranker_1_1_model.html#ac6e00f894c28c3bc36636983a0fc2bb6" title="This model&rsquo;s unique name.">name_</a>;
<a name="l00563"></a><a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f">00563</a>   <a class="code" href="classreranker_1_1_time.html" title="A simple class to hold the three notions of time during training: the current epoch, the current time index within the current epoch, and the absolute time index.">Time</a> <a class="code" href="classreranker_1_1_model.html#ac23eff7aa52c83c566658bcba9093c4f" title="The tiny object that holds the &quot;training time&quot; for this model (epoch, index and absolute time index)...">time_</a>;
<a name="l00566"></a><a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4">00566</a>   <a class="code" href="classreranker_1_1_kernel_function.html" title="An interface specifying a kernel function for two FeatureVector instances.">KernelFunction</a> *<a class="code" href="classreranker_1_1_model.html#a50128261606a9cb655493b3f9b9149c4" title="Yes, this is an interface, but we add the kernel function as a data member.">kernel_fn_</a>;
<a name="l00568"></a><a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2">00568</a>   <a class="code" href="classreranker_1_1_symbols.html" title="An interface specifying a converter from symbols (strings) to int indices.">Symbols</a> *<a class="code" href="classreranker_1_1_model.html#a8c0f904234605692035ba179f85c53e2" title="The symbol table for this model (may be NULL).">symbols_</a>;
<a name="l00571"></a><a class="code" href="classreranker_1_1_model.html#a9e7183bee1f50b058b17ab8e43cdbeef">00571</a>   shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#a9e7183bee1f50b058b17ab8e43cdbeef" title="A comparator to provide an ordering for candidates based on score when scoring all candidates in a se...">score_comparator_</a>;
<a name="l00574"></a><a class="code" href="classreranker_1_1_model.html#a8107be43f3916858a204c2d7c2f2d32e">00574</a>   shared_ptr&lt;Candidate::Comparator&gt; <a class="code" href="classreranker_1_1_model.html#a8107be43f3916858a204c2d7c2f2d32e" title="A comparator to provide an ordering for candidates to find the gold candidate in a set...">gold_comparator_</a>;
<a name="l00576"></a><a class="code" href="classreranker_1_1_model.html#abf7147622fb3c5801016fb7c479f3158">00576</a>   shared_ptr&lt;CandidateSet::Scorer&gt; <a class="code" href="classreranker_1_1_model.html#abf7147622fb3c5801016fb7c479f3158" title="A scorer for CandidateSet instances.">candidate_set_scorer_</a>;
<a name="l00578"></a><a class="code" href="classreranker_1_1_model.html#aac9c10b6d6a3eec5f781cfbf64bcdf22">00578</a>   shared_ptr&lt;UpdatePredicate&gt; <a class="code" href="classreranker_1_1_model.html#aac9c10b6d6a3eec5f781cfbf64bcdf22" title="The update predicate for this model.">update_predicate_</a>;
<a name="l00580"></a><a class="code" href="classreranker_1_1_model.html#a6af75a0de0ab2cfb3435919977341550">00580</a>   shared_ptr&lt;Updater&gt; <a class="code" href="classreranker_1_1_model.html#a6af75a0de0ab2cfb3435919977341550" title="The updater for this model.">updater_</a>;
<a name="l00582"></a><a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83">00582</a>   vector&lt;double&gt; <a class="code" href="classreranker_1_1_model.html#ad3a296860f768bee866213cc0c8bbf83" title="The average loss per epoch.">loss_per_epoch_</a>;
<a name="l00585"></a><a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b">00585</a>   vector&lt;int&gt; <a class="code" href="classreranker_1_1_model.html#ab308fe9304485e8c838ed2a196bb585b" title="The number of testing errors made on held-out development test data for each epoch.">num_testing_errors_per_epoch_</a>;
<a name="l00587"></a><a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914">00587</a>   vector&lt;int&gt; <a class="code" href="classreranker_1_1_model.html#a1f40d6deeb75c42c3cf78d73e71f0914" title="The number of errors made on training examples during each epoch.">num_training_errors_per_epoch_</a>;
<a name="l00591"></a><a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7">00591</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#ac9bd9064006d70c36391818fa6a628b7" title="The number of errors made on training examples.">num_training_errors_</a>;
<a name="l00595"></a><a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e">00595</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#ace86345c7febd6401dc3f48ad555f02e" title="The number of times an update was performed on this model during training.">num_updates_</a>;
<a name="l00597"></a><a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f">00597</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#a2a22810704e9c2cde4cc6cd9c2c1531f" title="The minimum number of training epochs to execute.">min_epochs_</a>;
<a name="l00599"></a><a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db">00599</a>   <span class="keywordtype">int</span> <a class="code" href="classreranker_1_1_model.html#adf7fefff5cd4576a101c1fe4c390d9db" title="The maximum number of training epochs to execute.">max_epochs_</a>;
<a name="l00601"></a><a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea">00601</a>   <a class="code" href="classreranker_1_1_model_1_1_hook.html" title="An interface for specifying a hook to be run by a Model instance.">Hook</a> *<a class="code" href="classreranker_1_1_model.html#a97e6523258a589e4fedb67b3a6364cea" title="A hook to be performed at the end of every epoch.">end_of_epoch_hook_</a>;
<a name="l00604"></a><a class="code" href="classreranker_1_1_model.html#a0601602d295f4b069e11ddebf941c2a5">00604</a>   <span class="keywordtype">bool</span> <a class="code" href="classreranker_1_1_model.html#a0601602d295f4b069e11ddebf941c2a5" title="Indicates whether this model should weight each candidate&rsquo;s loss by the value returned by CandidateSe...">use_weighted_loss_</a>;
<a name="l00605"></a>00605 };
<a name="l00606"></a>00606 
<a name="l00611"></a><a class="code" href="model_8_h.html#ad74eb70aab6b801346a43f6eecf9ebf6">00611</a> <span class="preprocessor">#define REGISTER_NAMED_MODEL(TYPE,NAME) REGISTER_NAMED(TYPE,NAME,Model)</span>
<a name="l00612"></a>00612 <span class="preprocessor"></span>
<a name="l00617"></a><a class="code" href="model_8_h.html#a9ebfdbfca885b4b3db9fd5936dcfa553">00617</a> <span class="preprocessor">#define REGISTER_MODEL(TYPE) REGISTER_NAMED_MODEL(TYPE,TYPE)</span>
<a name="l00618"></a>00618 <span class="preprocessor"></span>
<a name="l00624"></a><a class="code" href="model_8_h.html#a1191f25c550ec9317251bfc0850d6988">00624</a> <span class="preprocessor">#define REGISTER_NAMED_MODEL_UPDATE_PREDICATE(TYPE,NAME) \</span>
<a name="l00625"></a>00625 <span class="preprocessor">  REGISTER_NAMED(TYPE,NAME,Model::UpdatePredicate)</span>
<a name="l00626"></a>00626 <span class="preprocessor"></span>
<a name="l00632"></a><a class="code" href="model_8_h.html#a9e7a74f52f92b1187a8742ef861c52d8">00632</a> <span class="preprocessor">#define REGISTER_MODEL_UPDATE_PREDICATE(TYPE) \</span>
<a name="l00633"></a>00633 <span class="preprocessor">  REGISTER_NAMED_MODEL_UPDATE_PREDICATE(TYPE,TYPE)</span>
<a name="l00634"></a>00634 <span class="preprocessor"></span>
<a name="l00640"></a><a class="code" href="model_8_h.html#ada2995d09a8d1bcb3745fc4cc38c8daf">00640</a> <span class="preprocessor">#define REGISTER_NAMED_MODEL_UPDATER(TYPE,NAME) \</span>
<a name="l00641"></a>00641 <span class="preprocessor">  REGISTER_NAMED(TYPE,NAME,Model::Updater)</span>
<a name="l00642"></a>00642 <span class="preprocessor"></span>
<a name="l00647"></a><a class="code" href="model_8_h.html#a53d2e5769422ca713c4827680e6aff00">00647</a> <span class="preprocessor">#define REGISTER_MODEL_UPDATER(TYPE) \</span>
<a name="l00648"></a>00648 <span class="preprocessor">  REGISTER_NAMED_MODEL_UPDATER(TYPE,TYPE)</span>
<a name="l00649"></a>00649 <span class="preprocessor"></span>
<a name="l00650"></a>00650 }  <span class="comment">// namespace reranker</span>
<a name="l00651"></a>00651 
<a name="l00652"></a>00652 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Apr 9 2013 11:56:29 for Reranker Framework (ReFr) by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
